<template>
  <div class="list-ext-col">
    <template v-if="type=='btn'">
      <el-tag class="op-item" v-for="item in items" :key="item.text" :type="item.type||'primary'" @click.native="clickRow(item)">{{item.text}}
      </el-tag>
    </template>
    <template v-else>
      <span v-for="(item,index) in items" :key="item.text">
        <span v-if="index>0" style="margin: 0 3px">|</span>
        <el-link class="op-item" :type="item.type||'primary'" @click.native="clickRow(item)">{{item.text}}</el-link>
      </span>
    </template>

  </div>
</template>

<script>
  export default {
    name: "list-table-col",
    props: {
      scope: {
        default: null
      },
      type: {value: String, default: 'label'},
      items: {
        value: Array,//{text:'详情',emit:'more',type:'primary'}
        require: true
      }
    },
    methods: {
      clickRow(item) {
        this.$bus.$emit(item.emit, this.scope.row);
      }
    }
  }
</script>

<style lang="scss">
  .list-ext-col {
    .op-item {
      cursor: pointer;
    }
  }

</style>
